<template>
  <div class="uploadList">
    <el-table :data="tableList" stripe border class="user-table" :height="tableHeight" style="width: 100%;" v-loading="loading">
      <el-table-column fixed type="index" label="序号" sortable min-width="30"></el-table-column>
      <el-table-column prop="code" label="自定义编码" sortable width="100"></el-table-column>
      <el-table-column prop="planAttribute" label="计划属性" sortable width="100"></el-table-column>
      <el-table-column prop="priority" label="优先级" sortable min-width="100" > </el-table-column>
      <el-table-column prop="wbPlanFinsihDate" label="外包计划完成时间" sortable width="100" :formatter="timeFormatter"></el-table-column>
      <el-table-column prop="nums" label="件数" sortable width="60"></el-table-column>
      <el-table-column prop="makeNo" label="生产令号" sortable min-width="200"></el-table-column>
      <el-table-column prop="drawName" label="图纸名称" sortable min-width="120"></el-table-column>
      <el-table-column prop="drawNums" label="项目图纸张数"  width="50"  align="center"></el-table-column>
      <el-table-column prop="drawCode" label="图纸编号" sortable min-width="120"></el-table-column>
      <el-table-column prop="isUploadDraw" label="上传资料" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isUploadDraw ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="isMaterialArrvie" label="是否到料" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isMaterialArrvie ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="isMaterialTailor" label="是否下料" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isMaterialTailor ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="isFinishProcess" label="工艺编制" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isFinishProcess ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="isFinishProgram" label="编程" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isFinishProgram ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
            <!-- <el-table-column prop="insertOrder" label="计划是否下达" width="40"  align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.insertOrder ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
              </template>
            </el-table-column>
            <el-table-column prop="insertOrder" label="刀具是否齐备" width="40"  align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.insertOrder ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
              </template>
            </el-table-column>
            <el-table-column prop="insertOrder" label="是否首检" width="40"  align="center">
            <template slot-scope="scope">
                <span v-if="scope.row.insertOrder ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
              </template>
            </el-table-column>
            <el-table-column prop="insertOrder" label="是否检验" width="40"  align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.insertOrder ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
              </template>
            </el-table-column>
            <el-table-column prop="insertOrder" label="是否出货" width="40"  align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.insertOrder ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
              </template>
            </el-table-column>
            <el-table-column prop="insertOrder" label="是否结账" width="40"  align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.insertOrder ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
              </template>
            </el-table-column> -->
            <el-table-column prop="currentState" label="任务状态" sortable width="120"></el-table-column>
      <el-table-column prop="importerName" label="导入人" sortable width="100"></el-table-column>
      <el-table-column prop="importDate" label="导入时间" sortable min-width="100" :formatter="timeFormatter"></el-table-column>
      <el-table-column fixed="right" label="操作" align="right" min-width="120">
        <template slot-scope="scope">
          <slot  :row="scope.row"></slot>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pagination.currentPage" :page-sizes="[10, 15,20, 25,30,50, 100]" :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"></el-pagination>
  </div>
</template>
<script>
import testApi from 'plugins/axios/testApi.js';
export default {
  name: 'productionPlanList',
  props:{
    postData:{
      type:Object
    }
  },
  data (){
    return {
      loading:false,
      tableList:[],
      pagination:{/**分页参数 */
        currentPage:1,
        pageSize:10,
        total:0
      },
    }
  },
  watch:{
    
  },
  created(){

  },
   computed:{
    tableHeight(){
      return this.$store.state.clientHeight-184;
    }
  },
  methods:{
    /**时间格式化 */
    timeFormatter(row, column, cellValue, index){
      return cellValue?this.timestampToTime(cellValue,'yyyy-mm-dd'):'';
    },
    get29TableList(){
      let self = this;
      self.loading = true;
      let obj = {
        drawCode:self.postData.drawCode,
        makeNo:self.postData.makeNo,
        code:self.postData.code,
        currentPage:self.pagination.currentPage,
        pageSize:self.pagination.pageSize,
        isUploadDraw:1,/**是否上传资料 */
        isMaterialArrvie:1,/**是否到料 */
        isMaterialTailor:1,/**是否下料 */
        isFinishProcess:1,/**工艺编制是否完成 */
        isFinishProgram: 1,/**是否完成编程 */
        state:self.postData.state
      }
      testApi.testTaskList(obj).then(res=>{
        self.loading = false;
        self.tableList= res.content.records;
        self.pagination.total =res.content.total;
      },error=>{
        self.loading = false;
      })
    },
    handleSizeChange(size){/**切换分页条数 */
      this.pagination.pageSize=size;
      this.pagination.currentPage=1;
      this.get29TableList();
    },
    handleCurrentChange(current){/**切换分页页数 */
      this.pagination.currentPage=current;
      this.get29TableList();
    }
  }
}
</script>
<style lang="stylus" scoped>

</style>